package main

import (
	"fmt"
)

type Person struct {
	name string
	age int
}

func main() {
	list := make([]interface{}, 3)
	list[0] = 1
	list[1] = "string"
	list[2] = Person{"lily", 21}

	for i, item := range list{
		switch v := item.(type) {
		case int:
			fmt.Printf("list[%d] is int, value is %d\n", i, v)
		case string:
			fmt.Printf("list[%d] is string, value is %s\n", i, v)
		case Person:
			fmt.Printf("list[%d] is Student, value is %+v\n",i, v)
		}
	}
}
